package main

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/toolbox"
	_ "mdblog/common"
	"mdblog/controllers"
	_ "mdblog/models"
	"mdblog/models/analysis"
	_ "mdblog/routes"
	_ "mdblog/tasks"
)

func init() {
	// error page
	beego.ErrorController(&controllers.ErrorController{})

	// site config
	beego.BConfig.CopyRequestBody = true
	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.BConfig.WebConfig.TemplateLeft = "<<<"
	beego.BConfig.WebConfig.TemplateRight = ">>>"

	// filter
	beego.InsertFilter("/*", beego.BeforeRouter, analysis.VisitLogFilter)
}

func main() {
	toolbox.StartTask()
	beego.Run()
}
